package com.authenticateCenter.mapper;

import com.authenticateCenter.domain.entity.Authority;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.common.mybaits.CustomPage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 大忽悠
 * @since 2022年10月08日
 */
public interface AuthorityMapper extends BaseMapper<Authority> {

    @Select("select authority.* from authority inner join role_authority ra on ra.aid=authority.id " +
            "where rid=#{rId}")
    List<Authority> getAuthoritysByRid(@Param("rId") Integer rId);

    @Select("select authority.* from authority inner join role_authority ra on ra.aid=authority.id " +
            "where rid=#{rId} limit (#{page.pageNum}-1)*#{page.pageSize},#{page.pageSize}")
    List<Authority> getAuthoritysByRidWithPage(@Param("rId")Integer rId, @Param("page") CustomPage customPage);
}
